export default {
    namespaced: true,
    state: {
        // 控制组件状态
        isShowToast: false,
        toastTitle: "vue的内容",
        toastType: "success"
    },
    mutations: {
        ChangeShowToast(state, payload) {
            state.isShowToast = payload.showToast;
            state.toastTitle = payload.showMsg;
            state.toastType = payload.showType;
        }
    },
    actions: {
        asyncShowToast(context, payload) {
            // 显示 并传值 对应的提示
            context.commit('ChangeShowToast', payload)
            // 定时
            setTimeout(() => {
                context.commit('ChangeShowToast', {
                    showToast: false
                })
            }, 2000);
        }
    }
}